package com.hz.zbl.mapper;

import com.hz.zbl.model.entity.GradeEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GradeMapper {

    @Insert("INSERT INTO grades VALUES (null, #{grade_name}, #{grade_year})")
    int addGrade(GradeEntity gradeEntity);

    @Select("SELECT * FROM grades WHERE grade_name = #{grade_name}")
    GradeEntity selectGradeByName(@Param("grade_name") String grade_name);

    @Select("SELECT * FROM grades WHERE id = #{id}")
    GradeEntity selectGradeById(@Param("id") int id);

    @Delete("DELETE FROM grades WHERE id = #{id}")
    int deleteGradeById(@Param("id") int id);

    @Select("SELECT * FROM grades")
    List<GradeEntity> selectAllGrades();

}
